package com.zt.yongxinbao.controller;

import com.zt.yongxinbao.service.GoodsService;
import com.zt.yongxinbao.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;
    @PostMapping("/selectAll")
    public CommonResult selectAll(){
        return CommonResult.success(goodsService.selectAll());
    }
    @PostMapping("/selectById/{id}")
    public CommonResult selectById(@PathVariable Integer id){
        return CommonResult.success(goodsService.selectById(id));
    }
    @PostMapping("/selectByTag/{tag}")
    public CommonResult selectByTag(@PathVariable String tag){
        return  CommonResult.success(goodsService.selectByTag(tag));
    }
}
